package main

import (
	"fmt"
	"ksirGo/global"
	"ksirGo/initialize"
	"ksirGo/utils"

	"go.uber.org/zap"
)

func main() {
	global.VIPER = initialize.Viper()
	global.LOGGER = initialize.Logger()
	global.DB = initialize.Gorm()
	global.REDIS = initialize.Redis()
	global.MINIO = initialize.MinIO()
	if global.MINIO != nil {
		utils.InitBucket()
	}

	if err := initialize.Routers().Run(fmt.Sprintf(":%d", global.CONFIG.System.Port)); err != nil {
		fmt.Println("启动失败：", err.Error())
		global.LOGGER.Info("启动失败", zap.String("原因", err.Error()))
	}
}
